package com.future.direction.ui.activity;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.future.direction.R;
import com.future.direction.data.bean.ChosePayWayBean;
import com.future.direction.di.component.AppComponent;
import com.future.direction.ui.adapter.ChosePayWayAdapter;
import com.future.direction.ui.widget.MyTitleBar;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ChosePayWayActivity extends BaseActivity implements View.OnClickListener {


    @BindView(R.id.titleBar)
    MyTitleBar titleBar;
    @BindView(R.id.recycle_pay_way)
    RecyclerView recyclePayWay;
    @BindView(R.id.tv_immediately_pay)
    TextView tvImmediatelyPay;
    private ChosePayWayAdapter chosePayWayAdapter;

    @Override
    public int setLayout() {
        return R.layout.activity_chose_pay_way;
    }

    @Override
    public void getExtras() {

    }

    @Override
    public boolean init() {
        initView();
        initRecycle();
        return false;
    }
    private void initView() {
        backListener(titleBar);
    }
    private void initRecycle() {
        List<ChosePayWayBean> chosePayWayBeans = new ArrayList<>();
        ChosePayWayBean wechat = new ChosePayWayBean();
        wechat.setHeader(R.drawable.icon_wechat);
        wechat.setTitle("微信");
        ChosePayWayBean zfb = new ChosePayWayBean();
        zfb.setHeader(R.drawable.icon_zfb);
        zfb.setTitle("支付宝");
        chosePayWayBeans.add(wechat);
        chosePayWayBeans.add(zfb);
        LinearLayoutManager layout = new LinearLayoutManager(this);
        recyclePayWay.setLayoutManager(layout);
        chosePayWayAdapter = new ChosePayWayAdapter(R.layout.item_chose_pay_way, chosePayWayBeans);
        recyclePayWay.setAdapter(chosePayWayAdapter);
    }



    @Override
    public void setListener() {
        chosePayWayAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                chosePayWayAdapter.setChoseId(position);
            }
        });
        tvImmediatelyPay.setOnClickListener(this);

    }

    @Override
    public void setupAcitivtyComponent(AppComponent appComponent) {

    }


    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tv_immediately_pay:

            break;
        }
    }
}
